﻿using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Shake.Framework.Utility
{
    public class NLogUtil
    {
        private static readonly Logger logger = LogManager.GetCurrentClassLogger();

        static NLogUtil()
        {
#if DEBUG
            logger.Factory.ThrowExceptions = true;
#endif
        }

        /// <summary>
        /// 致命错误
        /// </summary>
        public static void Fatal(Exception ex, string message)
        {
            logger.Fatal(ex, message);
        }

        public static void Fatal(string message)
        {
            logger.Fatal(message);
        }

        public static void Fatal<T>(T value)
        {
            logger.Fatal(value);
        }

        /// <summary>
        /// 错误
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="message"></param>
        public static void Error(Exception ex, string message)
        {
            logger.Error(ex, message);
        }
        public static void Error<T>(Exception ex, string message, object[] format)
        {
            logger.Error(ex, message, format);
        }

        public static void Error(string message)
        {
            logger.Error(message);
        }

        public static void Error<T>(T value)
        {
            logger.Error(value);
        }

        /// <summary>
        /// 信息
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="message"></param>
        public static void Info(Exception ex, string message)
        {
            logger.Info(ex, message);
        }

        public static void Info(string message)
        {
            logger.Info(message);
        }

        public static void Info<T>(T value)
        {
            logger.Info(value);
        }

        /// <summary>
        /// 调试
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="message"></param>
        public static void Debug(Exception ex, string message)
        {
            logger.Debug(ex, message);
        }

        public static void Debug(string message)
        {
            logger.Debug(message);
        }

        public static void Debug<T>(T value)
        {
            logger.Debug(value);
        }

        /// <summary>
        /// 追踪
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="message"></param>
        public static void Trace(Exception ex, string message)
        {
            logger.Trace(ex, message);
        }

        public static void Trace(string message)
        {
            logger.Trace(message);
        }

        public static void Trace<T>(T value)
        {
            logger.Trace(value);
        }

        /// <summary>
        /// 警告
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="message"></param>
        public static void Warn(Exception ex, string message)
        {
            logger.Warn(ex, message);
        }

        public static void Warn(string message)
        {
            logger.Warn(message);
        }

        public static void Warn<T>(T value)
        {
            logger.Warn(value);
        }
    }
}
